package com.cc.service.impl;

import com.cc.dao.EmployeeDao;
import com.cc.dao.impl.EmployeeDaoImpl;
import com.cc.entity.Employee;
import com.cc.entity.Page;
import com.cc.service.EmployeeService;

/**
 * @author CC
 * @version 1.0
 * @description: TODO
 * @date 2025/4/18 9:52
 */
public class EmployeeServiceImpl implements EmployeeService {
    private EmployeeDao employeeDao = new EmployeeDaoImpl();

    @Override
    public Page<Employee> getEmployeeList(Page<Employee> page, String empName) {
        return employeeDao.getEmployeeList(page, empName);
    }

    @Override
    public int edit(Employee employee) {
        int count = 0;
        if (employee.getId() != 0) {
            count = employeeDao.update(employee);
        } else {
            count = employeeDao.insert(employee);
        }
        return count;
    }
}
